//
// Created by Castle on 2025/10/21.
//


#include <iostream>
#include <ostream>
#include <bitset>

int main() {

    unsigned short int value {0xff0u};

    std::cout << "Size of short is: " << sizeof(short int) << std::endl;

    std::cout << "Value:" << std::bitset<16>(value) << ",dec: " << value << std::endl;

    value = static_cast<unsigned short int>(value >> 1);
    std::cout << "Value:" << std::bitset<16>(value) << ",dec: " << value << std::endl;

    // Shift left by one bit
    value = static_cast<unsigned short int>(value << 1);
    std::cout << "Value:" << std::bitset<16>(value) << ",dec: " << value << std::endl;

    // Shift by multiple bits in one go
    // Shift right by four bits
    value = static_cast<unsigned short int>(value >> 4);
    std::cout << "Value:" << std::bitset<16>(value) << ",dec: " << value << std::endl;

    return 0;
}
